/*
 * To change this license header, choose License Headers in Project Properties.
 * To change this template file, choose Tools | Templates
 * and open the template in the editor.
 */
package com.rd.project.service;

import com.rd.project.model.Gebruiker;
import java.util.List;
import javax.ejb.Stateful;
import javax.ejb.Stateless;
import javax.persistence.EntityManager;
import javax.persistence.PersistenceContext;
import javax.persistence.Query;

/**
 *
 * @author Kevin
 */
@Stateful
public class GebruikerServiceImpl implements GebruikerService {
    
    @PersistenceContext
    private EntityManager em;
    
    boolean authenticated = false;
    
    @Override
    public Gebruiker getGebruiker(String gebruikersnaam) {
        
        Query q = em.createNamedQuery("Gebruiker.findLogin");
        q.setParameter("gebruikersnaam", gebruikersnaam);
        //q.setParameter("password", password);
        if(q.getResultList().size() == 1){
            return (Gebruiker) q.getSingleResult();
            
        }else{
            return null;
        }
    }
    
    
    
}
